﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BasicSample
{
    public class Order
    {
        private struct LineItem
        {
            public int Qty;
            public string Product;
            public double Cost;

            public double Total
            {
                get
                {
                    return Cost * Qty;
                }
            }
        }

        private IList<LineItem> LineItems = new List<LineItem>();

        public void AddLineItem(int qty, string product, double cost)
        {
            LineItems.Add(new LineItem
            {
                Qty = qty,
                Product = product,
                Cost = cost
            });
        }


        public double TotalValue
        {
            get
            {
                return LineItems.Select(li => li.Total + GSTCalculator.Instance.GSTAmount(li.Product, li.Total)).Sum();
            }
        }
    }
}
